home *** CD-ROM | disk | FTP | other *** search
/ Game Programming in C++ - Start to Finish / GameProgrammingS.iso / Peon / PeonSDK-Win32-1.0.0.exe / {app} / PeonMain / include / SceneRoot.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-11-25  |  2.9 KB  |  97 lines

  1.  
  2. #ifndef __SCENEROOT_H_
  3. #define __SCENEROOT_H_
  4. /*
  5. Peon - Win32 Games Programming Library
  6. Copyright (C) 2002-2005 Erik Yuzwa
  7.  
  8. This library is free software; you can redistribute it and/or
  9. modify it under the terms of the GNU Library General Public
  10. License as published by the Free Software Foundation; either
  11. version 2 of the License, or (at your option) any later version.
  12.  
  13. This library is distributed in the hope that it will be useful,
  14. but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  16. Library General Public License for more details.
  17.  
  18. You should have received a copy of the GNU Library General Public
  19. License along with this library; if not, write to the Free
  20. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  21.  
  22. Erik Yuzwa
  23. peon AT wazooinc DOT com
  24. */
  25.  
  26.  
  27. #include "ISingleton.h"
  28. #include "SceneRenderer.h"
  29. #include "ISceneObject.h"
  30.  
  31. namespace peon
  32. {
  33.     /**
  34.     * This object represents the "Base node" of a scene graph for
  35.     * you to play with. Right now this is little more than a display
  36.     * list, but it gives you an idea of what's possible. To create
  37.     * a true Octree or QuadTree structure is left as your own
  38.     * exercise.
  39.     */
  40.     class PEONMAIN_API SceneRoot : public ISceneObject, ISingleton<SceneRoot>
  41.     {
  42.     protected:
  43.         /** our SceneRenderer handle */
  44.         SceneRenderer*    m_pRenderer;
  45.  
  46.     public:
  47.  
  48.         /**
  49.         * Constructor
  50.         */
  51.         SceneRoot( SceneRenderer* pRenderer );
  52.  
  53.         /**
  54.         * Destructor
  55.         */
  56.         ~SceneRoot();
  57.  
  58.         /** Override standard Singleton retrieval.
  59.         @remarks
  60.         Why do we do this? Well, it's because the Singleton
  61.         implementation is in a .h file, which means it gets compiled
  62.         into anybody who includes it. This is needed for the
  63.         Singleton template to work, but we actually only want it
  64.         compiled into the implementation of the class based on the
  65.         Singleton, not all of them. If we don't change this, we get
  66.         link errors when trying to use the Singleton-based class from
  67.         an outside dll.
  68.         @par
  69.         This method just delegates to the template version anyway,
  70.         but the implementation stays in this single compilation unit,
  71.         preventing link errors.
  72.         */
  73.         static SceneRoot& getSingleton(void);
  74.  
  75.         /** Override standard Singleton retrieval.
  76.         @remarks
  77.         Why do we do this? Well, it's because the Singleton
  78.         implementation is in a .h file, which means it gets compiled
  79.         into anybody who includes it. This is needed for the
  80.         Singleton template to work, but we actually only want it
  81.         compiled into the implementation of the class based on the
  82.         Singleton, not all of them. If we don't change this, we get
  83.         link errors when trying to use the Singleton-based class from
  84.         an outside dll.
  85.         @par
  86.         This method just delegates to the template version anyway,
  87.         but the implementation stays in this single compilation unit,
  88.         preventing link errors.
  89.         */
  90.         static SceneRoot* getSingletonPtr(void);
  91.  
  92.  
  93.     };
  94. }
  95.  
  96. #endif
  97.